# -*- coding: iso-8859-2 -*-

import logging

logger = None
loggerInitialized = False

class GlobalLogger:
    '''
    GLobal logger for the project
    '''
           
    def _initLogger():
        '''
        Set logging level, message format and init
        logger
        '''
        global loggerInitialized
        global logger
        
        logger = logging.getLogger("authorshipanalyzer")
        logger.setLevel(logging.DEBUG)
        
        ch = logging.StreamHandler()
        formatter = logging.Formatter("[%(module)s][%(levelname)s]: %(message)s")
        ch.setFormatter(formatter)
        
        logger.addHandler(ch)
        logger.info("Logger initialized")
        loggerInitialized = True
       
    _initLogger = staticmethod(_initLogger)  
        
    def getLogger():
        '''
        @return: logger
        '''
        global loggerInitialized
        global logger
        
        if loggerInitialized == False:
            GlobalLogger._initLogger()
        return logger
    
    getLogger = staticmethod(getLogger)
    
if __name__ == "__main__":
    logger = GlobalLogger.getLogger()
    logger = GlobalLogger.getLogger()
    logger = GlobalLogger.getLogger()

    
        

